﻿namespace GoodAdmin.System;

/// <summary>
/// 系统用户表
/// </summary>
[SugarTable(tableName:"Sys_User", "系统用户表")]
public class SysUser: BaseEntity
{
    /// <summary>
    /// 帐号
    /// </summary>
    [SugarColumn(ColumnDescription = "帐号", Length = 32)]
    public virtual string Account { get; set; }

    /// <summary>
    /// 密码
    /// </summary>
    [SugarColumn(ColumnDescription = "密码",Length =256)]
    public virtual string Password { get; set; }

    /// <summary>
    /// 姓名
    /// </summary>
    [SugarColumn(ColumnDescription = "姓名", Length = 32)]
    public virtual string Name { get; set; }

    /// <summary>
    /// 工号
    /// </summary>
    [SugarColumn(ColumnDescription = "工号", IsNullable = true, Length = 32)]
    public string WorkId { get; set; }

    /// <summary>
    /// 性别
    /// </summary>
    [SugarColumn(ColumnDescription = "性别", IsNullable = true, Length = 8)]
    public string Gender { get; set; } 

    /// <summary>
    /// 出生日期
    /// </summary>
    [SugarColumn(ColumnDescription = "出生日期",IsNullable =true)]
    public DateTime? Birthday { get; set; }

    /// <summary>
    /// 民族
    /// </summary>
    [SugarColumn(ColumnDescription = "民族", Length = 32, IsNullable = true)]
    public string Nation { get; set; }

    /// <summary>
    /// 手机号码
    /// </summary>
    [SugarColumn(ColumnDescription = "手机号码", Length = 16)]
    [DataValidation(ValidationTypes.PhoneNumber,ErrorMessage ="手机号码格式不正确")]
    public string Phone { get; set; }

    /// <summary>
    /// 证件类型
    /// </summary>
    [SugarColumn(ColumnDescription = "证件类型", IsNullable = true, Length = 32)]
    public string CardType { get; set; }

    /// <summary>
    /// 证件号码
    /// </summary>
    [SugarColumn(ColumnDescription = "证件号码", Length = 32, IsNullable = true)]
    public string IdCardNum { get; set; }

    /// <summary>
    /// 邮箱
    /// </summary>
    [SugarColumn(ColumnDescription = "邮箱", Length = 64, IsNullable = true)]
    [DataValidation(ValidationTypes.EmailAddress,AllowNullValue =true)]
    public string Email { get; set; }

    /// <summary>
    /// 地址
    /// </summary>
    [SugarColumn(ColumnDescription = "地址", Length = 256, IsNullable = true)]
    public string Address { get; set; }

    /// <summary>
    /// 个人简介
    /// </summary>
    [SugarColumn(ColumnDescription = "个人简介", Length = 512, IsNullable = true)]
    public string Introduction { get; set; }

    /// <summary>
    /// 状态
    /// </summary>
    [SugarColumn(ColumnDescription = "状态", Length = 8)]
    public string Status { get; set; } = CommonConst.STATUS_ENABLE;

    /// <summary>
    /// 备注
    /// </summary>
    [SugarColumn(ColumnDescription = "备注", Length = 128, IsNullable = true)]
    public string Remark { get; set; }

    /// <summary>
    /// 组织Id
    /// </summary>
    [SugarColumn(ColumnDescription = "组织Id")]
    public virtual long OrgId { get; set; }

    /// <summary>
    /// 组织名称
    /// </summary>
    [SugarColumn(IsIgnore = true)]
    public string OrgName { get; set; }

    /// <summary>
    /// 职位Id
    /// </summary>
    [SugarColumn(ColumnDescription = "职位Id")]
    public virtual long PositionId { get; set; }

    /// <summary>
    /// 职位名称
    /// </summary>
    [SugarColumn(IsIgnore = true)]
    public string PosName { get; set; }

    /// <summary>
    /// 入职日期
    /// </summary>
    [SugarColumn(ColumnDescription = "入职日期", IsNullable = true)]
    public DateTime? JoinDate { get; set; }

    /// <summary>
    /// 头像
    /// </summary>
    [SugarColumn(ColumnDescription = "头像", ColumnDataType = StaticConfig.CodeFirst_BigString, IsNullable = true)]
    public string Avatar { get; set; }

    /// <summary>
    /// 电子签名
    /// </summary>
    [SugarColumn(ColumnDescription = "电子签名", ColumnDataType = StaticConfig.CodeFirst_BigString, IsNullable = true)]
    public string Signature { get; set; }
    /// <summary>
    /// 系统标识字段
    /// </summary>
    [SugarColumn(ColumnDescription = "系统标识", Length = 32, IsNullable = true)]
    public string SystemMark { get; set; }
}